package com.niuwa.p2p.entity.user;

import java.sql.Timestamp;
import java.util.Collection;
import java.util.Date;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.niuwa.p2p.core.mvc.entity.BaseHolder;

/**
 * 
 * @ClassName: User
 * @Descriptio:用户实体entity 映射表： NW_USER
 * @author: jishengjun
 */

public class User extends BaseHolder implements UserDetails {

	private static final long serialVersionUID = 962591705273698612L;


	/** 用户名 */
	private String userName;

	/** 登陆名 */
	private String loginName;

	/** 登陆密码 */
	private String loginPassword;

	/** 手机号 */
	private String tel;

	/** 邮件 */
	private String email;

	/** 提问 */
	private String question;

	/** 回答 */
	private String answer;

	/** 最后登陆时间 */
	private Date lastLoginTime;

	/** 状态 */
	private String status;

	public void setStatus(String status) {
		this.status = status;
	}

	/** 是否在线 */
	private String isOnline;

	/** 是否限制 */
	private String isLimit;

	private String passWord;

	/** 用户访问IP地址 */
	private String ip;

	/** 创建用户者 */
	private String creater;
	/** 修改用户者 */
	private String updater;
	/** 用户创建时间 */
	private Timestamp createTime;
	/** 用户修改时间 */
	private Timestamp updateTime;
	/** 删除标记 */
	private Character delFalg;

	public Character getDelFalg() {
		return delFalg;
	}

	public void setDelFalg(Character delFalg) {
		this.delFalg = delFalg;
	}



	public String getCreater() {
		return creater;
	}

	public void setCreater(String creater) {
		this.creater = creater;
	}

	public String getUpdater() {
		return updater;
	}

	public void setUpdater(String updater) {
		this.updater = updater;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Timestamp getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public Collection<GrantedAuthority> getGrantedAuths() {
		return grantedAuths;
	}

	public void setGrantedAuths(Collection<GrantedAuthority> grantedAuths) {
		this.grantedAuths = grantedAuths;
	}

	private Collection<GrantedAuthority> grantedAuths;

	public User() {
	}

	public User(String userName, String password, boolean enables,
			boolean accountNonExpired, boolean credentialsNonExpired,
			boolean accountNonLocked, Collection<GrantedAuthority> grantedAuths) {
		this.userName = userName;
		this.passWord = password;
		this.grantedAuths = grantedAuths;

	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getLoginPassword() {
		return loginPassword;
	}

	public void setLoginPassword(String loginPassword) {
		this.loginPassword = loginPassword;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public String getStatus() {
		return status;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getIsOnline() {
		return isOnline;
	}

	public void setIsOnline(String isOnline) {
		this.isOnline = isOnline;
	}

	public String getIsLimit() {
		return isLimit;
	}

	public void setIsLimit(String isLimit) {
		this.isLimit = isLimit;
	}

	@Override
	public Collection<GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return grantedAuths;
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return passWord;
	}

	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return userName;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

}
